
<?php 
session_start();

if($_SESSION['user']==null){
	header("Location:login.php");
}

?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<!-- <meta name="renderer" content="webkit|ie-comp|ie-stand"> -->
<!-- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> -->
<!-- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> -->
<!-- <meta http-equiv="Cache-Control" content="no-siteapp" /> -->
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/laydate.css" />
<link rel="stylesheet" type="text/css" href="static/laydate2.css" />
<link rel="stylesheet" type="text/css" href="static/laydate3.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />

<script charset="utf-8" src="static/jquery-1.11.1.min.js"></script>

<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>新增圖片</title>
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />


</head>
<body>
<div class="page-container">
	<form action="add.php" method="post" enctype="multipart/form-data" onsubmit='return checkForm()'>

		<div class="pic-type" style="margin: 10px 60px;">
			<label for="file" style="margin-right: 12px;">圖片分類:</label>
			<input class="selinput"  style="text-align: center;cursor: pointer; line-height: 40px;height: 40px;padding: 2px 8px;border:1px solid #ccc; outline: none;border-radius: 5px;width: 10%;" type="text" name="type" value ="案例"  >
			<div style="width: 11%;" class="type-list">

				<a href="javascript:void(0);" onClick="seltype1()">案例</a>

				<a href="javascript:void(0);" onClick="seltype3()">產品</a>

				<a href="javascript:void(0);" onClick="seltype4()">告示</a>

			</div>
		</div>

		<div style="margin: 10px 60px;">
			<label for="file" style="margin-right: 12px;">圖片标题:</label>
			<input style="line-height: 40px;height: 40px;padding: 2px 8px;border:1px solid #ccc; outline: none;border-radius: 5px;width: 80%;" type="text" name="title" placeholder="請輸入标题">
		</div>

		<div div style="margin: 10px 60px;">
			<label for="file" style="margin-right: 12px;">英文标题:</label>
			<input style="line-height: 40px;height: 40px;padding: 2px 8px;border:1px solid #ccc; outline: none;border-radius: 5px;width: 80%;" type="text" name="entitle" placeholder="請輸入英文标题">
		</div>

		<div div style="margin: 10px 60px;">
			<label for="file" style="margin-right: 12px;">圖片描述:</label>
			<input style="line-height: 40px;height: 40px;padding: 2px 8px;border:1px solid #ccc; outline: none;border-radius: 5px;width: 80%;" type="text" name="description" placeholder="請輸入圖片描述">
		</div>

		<div div style="margin: 10px 60px;">
			<label for="file" style="margin-right: 12px;">英文描述:</label>
			<input style="line-height: 40px;height: 40px;padding: 2px 8px;border:1px solid #ccc; outline: none;border-radius: 5px;width: 80%;" type="text" name="endesc" placeholder="請輸入圖片英文描述">
		</div>

		<div style="margin: 10px 60px;height: 60px;line-height: 60px;width: 60% ">
			<label for="file" style="margin-right: 20px">上傳圖片:</label>

			<input style="line-height: 40px;height: 40px;padding: 2px 8px;border: none; outline: none;border-radius: 5px;" type="file" name="file"  />
		</div>

		<div style="margin: 10px 60px;">
			<label for="" style="margin-right: 20px;">選擇時間：</label>
			<input placeholder="请输入日期" name="updateTime" class="laydate-icon timeUstyle stateUTime" onclick="laydate({istime: true,format:'YYYY-MM-DD hh:mm:ss'})">
		</div>
		<script type="text/javascript" src="static/laydate.js"></script>
			
		<div style="margin: 10px 60px;height: 60px;line-height: 60px;width: 60% ">
			<input style="width: 20%; line-height: 40px;height: 40px;padding: 2px 8px;border: none; outline: none;border-radius: 5px;" type="submit" value="Submit" />
		</div>

	</form>
</div>

		<script>
			$('.selinput').click(function(){
				$('.type-list').css('display','block');
			});
			function seltype1(){
				$('.selinput').val('案例');
				$('.type-list').css('display','none'); 
			}

			function seltype3(){
				$('.selinput').val('產品'); 
				$('.type-list').css('display','none'); 

			}
			function seltype4(){
				$('.selinput').val('告示'); 
				$('.type-list').css('display','none'); 

			}

			function checkForm(){
				var flag = 0;
				if($('.selinput').val()=="案例"||$('.selinput').val()=="產品"||$('.selinput').val()=="告示"){
					flag++;
				}else{			
					alert("請選擇圖片分類！");
					return false;
				}
				if($("input[name='title']").val()==""){
					alert("圖片標題不能爲空!");
					return false;
				}else{
					flag++;
				}
				if ($("input[name='entitle']").val()=="") {
					alert("圖片英文標題不能爲空");
					return false;
				}else{
					flag++;
				}
				if($("input[name='description']").val()==""){
					alert("圖片描述不能爲空！");
					return false;
				}else{
					flag++;
				}
				if($("input[name='endesc']").val()==""){
					alert("圖片英文描述不能爲空！");
					return false;
				}else{
					flag++;
				}
				if($("input[name='file']").val()==""){
					alert("上傳圖片内容不能爲空！");
					return false;
				}else{
					flag++;
				}
				if($("input[name='updateTime']").val()==""){
					alert("上傳時間不能爲空！");
					return false;
				}else{
					flag++;
				}

				if(flag==7){
					return true;
				}else{
					return false;
				}
			}
		</script>

</body>
</html>